// pages/modules/modules.js
Page({

  /**
   * 页面的初始数据
   */

  data: {
    memberList:[
        {iamges:"../images/location.png",
          cont:"重庆渝中逍遥游",
          discount:"赏数千载巴渝文化",
          hidden:true,
          id:"0",
          invalidActivty:[
            {
              price:"￥588",
              oldPrice:"￥788",
              validType:"6.8折",
              validTime:'7日游'
            },
            {
                price:"￥388",
                oldPrice:"￥588",
                validType:"6.5折",
                validTime:'3日游'
            },
          ]
        },
        {iamges:"../images/location.png",
          cont:"成都墨石逍遥游",
          discount:"网红打卡景点",
          hidden:true,
          id:1,
          invalidActivty:[
            {
              price:"￥588",
              oldPrice:"￥788",
              validType:"6.8折",
              validTime:'7日游'
            },
            {
                price:"￥388",
                oldPrice:"￥588",
                validType:"6.5折",
                validTime:'3日游'
            },
          ]
        },
        {iamges:"../images/location.png",
          cont:"杭州西湖逍遥游",
          discount:"赏数千载巴渝文化",
          hidden:true,
          id:"2",
          invalidActivty:[
            {
              price:"￥588",
              oldPrice:"￥788",
              validType:"6.8折",
              validTime:'7日游'
            },
            {
                price:"￥388",
                oldPrice:"￥588",
                validType:"6.5折",
                validTime:'3日游'
            },
          ]
        },
        {iamges:"../images/location.png",
          cont:"召唤师峡谷逍遥游",
          discount:"赏数千载巴渝文化",
          hidden:true,
          id:"3",
          invalidActivty:[
            {
              price:"￥588",
              oldPrice:"￥788",
              validType:"6.8折",
              validTime:'7日游'
            },
            {
                price:"￥388",
                oldPrice:"￥588",
                validType:"6.5折",
                validTime:'3日游'
            },
          ]
        },
    ]
  },
  isOpen:function(e){
      var that = this;
      var idx = e.currentTarget.dataset.index;
      console.log(idx);
      var memberList = that.data.memberList;
      console.log(memberList);
      for (let i=0; i < memberList.length; i++){
          if (idx == i) {
              memberList[i].hidden=!memberList[i].hidden;
          } else {
             memberList[i].hidden=true;
          }
      }
      this.setData({memberList:memberList});
      return true;
    },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})